﻿using IBll;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace WebAop.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class EmployeeController : ControllerBase, IEmployeeBll
    {
          public EmployeeController(IEmployeeBll bll)
        {
            Bll = bll;
        }

        public IEmployeeBll Bll { get; }

        [HttpPost]
        public Task<int> AddAnync(Employee employee)
        { 
             return Bll.AddAnync(employee);
        }


        [HttpGet]
        public Employee FindEmployee(int id)
        {
             return  Bll.FindEmployee(id);
        }

        [HttpGet]
        public EnpDto ShwoEmployee(int index, int size)
        {
           return Bll.ShwoEmployee(index, size);
        }

        [HttpPost]
        public Task<int> UpdateAnync(Employee employee)
        {
            return Bll.UpdateAnync(employee);
        }
    }
}
